<?php
namespace app\admin\validate;

use think\Validate;

class Task extends Validate{
    protected $rule = [
        'task_name'  => 'require',
        'task_url' => 'require|unique:Task',
        'task_start_time'   => 'require',
        'task_description'   => 'require',
    ];
    protected $message = [
        'task_name.require'  => '任务名称不能为空！',
        'task_url.require'  => '任务地址不能为空！',
        'task_url.unique'  => '任务地址已存在！',
        'task_start_time.require'  => '请求时间不能为空！',
        'task_description.require'  => '任务描述不能为空！',
    ];
    protected $scene=[
        'add_task'=>[
            'task_name' ,
            'task_url' ,
            'task_start_time' ,
            'task_description' ,
        ],
        'edit_task'=>[
            'task_name' ,
            'task_url' ,
            'task_start_time' ,
            'task_description' ,
        ],
    ];
}